<script setup>
import { getCurrentInstance, onMounted } from 'vue';
const { proxy } = getCurrentInstance()
onMounted(() => {
  proxy.$Theme()
  proxy.$Msg.warning('1111')
})
</script>

<template>
  <router-view v-slot="{ Component, route }">
    <div class="app-background">
      <div class="line"></div>
      <div class="line"></div>
      <div class="line"></div>
      <div class="line"></div>
      <div class="line"></div>
      <div class="line"></div>
      <div class="line"></div>
      <div class="line"></div>
      <div class="line"></div>
    </div>
    <transition name="app" mode="out-in">
      <component :is="Component" :key="route.path" />
    </transition>
  </router-view>
</template>

<style scoped lang="scss">
.app-background {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  z-index: -99;
  background-color: var(--theme-color1);
}

.line {
  position: absolute;
  width: 1px;
  height: 100%;
  top: 0;
  left: 50%;
  overflow: hidden;
  z-index: -98;
}


.line::after {
  content: "";
  display: block;
  position: absolute;
  height: 15vh;
  width: 100%;
  top: -50%;
  left: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, var(--theme-color2) 100%);
  -webkit-animation: drop 7s 0s infinite;
  animation: drop 7s 0s infinite;
  -webkit-animation-fill-mode: forwards;
  animation-fill-mode: forwards;
  -webkit-animation-timing-function: cubic-bezier(0.4, 0.26, 0, 0.97);
  animation-timing-function: cubic-bezier(0.4, 0.26, 0, 0.97);
}

.line:nth-child(1) {
  margin-left: -40%;

  &::after {
    -webkit-animation-delay: 2s;
    animation-delay: 2s;
  }
}

.line:nth-child(2) {
  margin-left: -30%;

  &::after {
    -webkit-animation-delay: 1.6s;
    animation-delay: 1.6s;
  }
}

.line:nth-child(3) {
  margin-left: -20%;

  &::after {
    -webkit-animation-delay: 2.4s;
    animation-delay: 2.4s;
  }
}

.line:nth-child(4) {
  margin-left: -10%;

  &::after {
    -webkit-animation-delay: 0.8s;
    animation-delay: 0.8s;
  }
}

.line:nth-child(5) {
  &::after {
    -webkit-animation-delay: 1.8s;
    animation-delay: 1.8s;
  }
}

.line:nth-child(6) {
  margin-left: 10%;

  &::after {
    -webkit-animation-delay: 1.1s;
    animation-delay: 1.1s;
  }
}

.line:nth-child(7) {
  margin-left: 20%;

  &::after {
    -webkit-animation-delay: 0.5s;
    animation-delay: 0.5s;
  }
}

.line:nth-child(8) {
  margin-left: 30%;

  &::after {
    -webkit-animation-delay: 2.2s;
    animation-delay: 2.2s;
  }
}

.line:nth-child(9) {
  margin-left: 40%;

  &::after {
    -webkit-animation-delay: 1.4s;
    animation-delay: 1.4s;
  }
}

@-webkit-keyframes drop {
  0% {
    top: -50%;
  }

  100% {
    top: 110%;
  }
}

@keyframes drop {
  0% {
    top: -50%;
  }

  100% {
    top: 110%;
  }
}

// Transition animation start

.app-enter-from,
.app-leave-to {
  transform: translateX(100px);
  opacity: 0;
  filter: blur(15px);
}

.app-enter-to,
.app-leave-from {
  opacity: 1;
}

.app-enter-active {
  transition: all 0.5s ease;
}

.app-leave-active {
  transition: all 0.2s cubic-bezier(1, 0.6, 0.6, 1);
}

// Transition animation done

.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;

  .ss {
    color: red
  }
}

.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}

.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
